var userLists = [
  { _id: '1001', name: 'vue' },
  { _id: '1002', name: 'react' },
  { _id: '1003', name: 'ts' }
];
var userListsObj = {
  1001: { _id: '1001', name: 'vue' },
  1002: { _id: '1002', name: 'react' },
  1003: { _id: '1003', name: 'ts' }
};
// 将数组转为对象形式
var arrToObj = function (arr) {
  return arr.reduce(function (prev, current) {
    if (current._id) {
      prev[current._id] = current;
    }
    return prev;
  }, {});
};
console.log(arrToObj(userLists));
var objToArray = function (obj) {
  return Object.keys(obj).map(function (k) {
    return obj[k];
  });
};
console.log(objToArray(userListsObj));
